package com.jinsi.service.impl;

import com.jinsi.mapper.StuOperationLogMapper;
import com.jinsi.pojo.ScStudent;
import com.jinsi.pojo.ScStudentOperationLog;
import com.jinsi.service.StuOperationLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StuOperationLogServiceImpl implements StuOperationLogService {
    @Autowired
    private StuOperationLogMapper mapper;

    @Override
    public List<ScStudentOperationLog> getStuOperationLog(Integer status) {
        List<ScStudentOperationLog> list = mapper.getStuOperationLog(status);
        return list;
    }

    @Override
    public void addLog(ScStudentOperationLog log) throws Exception {
        int num = mapper.addLog(log);
        if (num == 0){
            throw new Exception();
        }
    }

    @Override
    public ScStudent getStudent(Integer classesId) {
        ScStudent student = mapper.getStudent(classesId);
        return student;
    }

    @Override
    public void delStuOperationLog(Integer id) throws Exception {
        int num = mapper.delStuOperationLog(id);
        if (num == 0){
            throw new Exception();
        }
    }

    @Override
    public void upLog(ScStudentOperationLog log) throws Exception {
        int num = mapper.upLog(log);
        if (num == 0){
            throw new Exception();
        }
    }

}
